import { AntdModalProps } from '@/hooks/useAntdModal';
import { saveAccount, saveMapping, saveNotice } from '@/service/globalSetting';
import { Checkbox, Divider, Form, Input, Modal, Radio, Select } from 'antd';
import React from 'react';

const SaveAccount = ({ form, modalProps,closeModal,refresh, }: AntdModalProps) => {
  const onOk = async () => {
    let data = await form.validateFields()
    console.log('sss',form.isFieldTouched('password'))
   if(data.password==='******'){
     delete data.password
   }
   await saveAccount(data)
   closeModal();
   refresh()
  }
  return (<Modal width={800} title="账号" {...modalProps} onOk={onOk}>
    <Form form={form} labelCol={{ span: 4 }}
     
    >
      <Form.Item hidden name='id'>
        <Input />
      </Form.Item>
      
     
     
      <Form.Item label="账号" name='account' rules={[{
        required: true,
        message: '账号'
      }]}>
        <Input placeholder='账号' />
      </Form.Item>
      <Form.Item label="密码" name='password' rules={[{
        required: true,
        message: '密码'
      }]}>
        <Input.Password placeholder='密码' />
      </Form.Item>
      <Form.Item label="邮箱" name='email' rules={[{
        required: true,
        message: '邮箱'
      }]}>
        <Input placeholder='邮箱' />
      </Form.Item>
      <Form.Item label="云效ID" name='codeupId' rules={[{
        required: true,
        message: '云效ID'
      }]}>
        <Input placeholder='云效ID' />
      </Form.Item>
      <Form.Item label="员工ID" name='staffId' rules={[{
        required: true,
        message: '员工ID'
      }]}>
        <Input placeholder='员工ID' />
      </Form.Item>
    </Form>
  </Modal>)
}
export default SaveAccount